/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.panels;

import Berekenen.Calc;
import Components.GrafiekType;
import Delta.Laminaat;
import GUI.*;
import laminaatapplicatie.Global;

/**
 *
 * @author Memet
 */
public class LaminateOperationPanel extends javax.swing.JPanel {

    /**
     * Creates new form LaminateOperationPanel
     */
    Laminaat lam;
    public LaminateOperationPanel() {
        initComponents();
        
        lam= null;
    }
    
    public void setLaminate(Laminaat laminaat)
    {
        this.lam = laminaat;
        reCalculate();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel5 = new javax.swing.JPanel();
        btnChart = new javax.swing.JButton();
        cbChartType = new javax.swing.JComboBox();
        cbChart = new javax.swing.JComboBox();
        lblName = new javax.swing.JLabel();
        btnEdit = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        lblE1 = new javax.swing.JLabel();
        lblE2 = new javax.swing.JLabel();
        lblG12 = new javax.swing.JLabel();
        lblv12 = new javax.swing.JLabel();
        lblRho = new javax.swing.JLabel();
        lblH = new javax.swing.JLabel();
        btnMore = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        lblERho = new javax.swing.JLabel();
        btnExport = new javax.swing.JButton();
        btnLayUp = new javax.swing.JButton();
        btnRapport = new javax.swing.JButton();

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Charts"));

        btnChart.setText("Show Chart");
        btnChart.setToolTipText("Not yet supported");
        btnChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnChartActionPerformed(evt);
            }
        });

        cbChartType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Liniair", "Polar" }));

        cbChart.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "E over Θ", "G over Θ", "v over Θ" }));

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(13, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnChart, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cbChart, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cbChartType, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(cbChart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbChartType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnChart)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblName.setFont(new java.awt.Font("Trebuchet MS", 1, 24)); // NOI18N
        lblName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblName.setText("<Name>");

        btnEdit.setText("Edit");
        btnEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditActionPerformed(evt);
            }
        });

        btnDelete.setText("Delete");
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel1.setText("E1:");

        jLabel2.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel2.setText("E2:");

        jLabel3.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel3.setText("G12:");

        jLabel4.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel4.setText("v12:");

        jLabel5.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel5.setText("ρ:");

        jLabel6.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel6.setText("Thickness:");

        lblE1.setText("<E1> GPa");

        lblE2.setText("<E2> GPa");

        lblG12.setText("<G12> GPa");

        lblv12.setText("<v12>");

        lblRho.setText("<rho> Kg/m3");

        lblH.setText("<h> mm");

        btnMore.setText("More...");
        btnMore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoreActionPerformed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Trebuchet MS", 1, 11)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("E/ρ:");
        jLabel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        lblERho.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblERho.setText("0");
        lblERho.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel4)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblv12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblG12, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
                            .addComponent(lblE2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblERho, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addGap(10, 10, 10)
                                .addComponent(lblRho, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnMore)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(lblE1)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(lblE2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(lblG12))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(lblv12)))
                    .addComponent(lblERho, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(lblH))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(lblRho)))
                    .addComponent(btnMore))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        btnExport.setText("Export to Ansys");
        btnExport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExportActionPerformed(evt);
            }
        });

        btnLayUp.setText("Plot layup");
        btnLayUp.setToolTipText("Not yet supported");
        btnLayUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLayUpActionPerformed(evt);
            }
        });

        btnRapport.setText("Report");
        btnRapport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRapportActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnEdit, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnDelete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnLayUp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnRapport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnExport, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblName, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblName)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnDelete)
                        .addComponent(btnEdit)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(btnLayUp)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnRapport)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnExport))))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btnChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChartActionPerformed
        GrafiekType type = GrafiekType.LINEAR;
        if (cbChartType.getSelectedIndex() == 1) {
            type = GrafiekType.POLAR;
        }
        if (cbChart.getSelectedIndex() == 0) {
            //E over theta
            EChart frmE = new EChart();
            frmE.setVisible(true);
            frmE.setInfo(type, lam);
        } else if (cbChart.getSelectedIndex() == 1) {            
            GChart frmG = new GChart();
            
            frmG.setVisible(true);
            frmG.setInfo(type, lam);
        } else if (cbChart.getSelectedIndex() == 2) {
            NuChart frmNu = new NuChart();
            
            frmNu.setVisible(true);
            frmNu.setInfo(type, lam);
        }
    }//GEN-LAST:event_btnChartActionPerformed

    private void btnEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditActionPerformed
        laminateBuilder frm = new laminateBuilder();
        frm.loadLaminate(lam);
        frm.setVisible(true);
    }//GEN-LAST:event_btnEditActionPerformed

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
        Global.data.deleteLaminaat(lam);
        lam = null;
        Global.menu.getLaminatePane().clearSelection();
        this.reCalculate();
        Global.menu.refreshScreens();
    }//GEN-LAST:event_btnDeleteActionPerformed

    private void btnMoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoreActionPerformed
        showLaminateDetails frm = new showLaminateDetails();
        frm.setLaminaat(lam);
        frm.setVisible(true);
    }//GEN-LAST:event_btnMoreActionPerformed

    private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportActionPerformed
        exportToAnsysForm frm = new exportToAnsysForm();
        frm.setLam(lam);
        frm.setVisible(true);
    }//GEN-LAST:event_btnExportActionPerformed

    private void btnLayUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLayUpActionPerformed
//        layupForm frm = new layupForm();
//        // btnLayUp.setEnabled(false);
//        frm.setVisible(true);
//        frm.setLaminate(lam);
    }//GEN-LAST:event_btnLayUpActionPerformed

    private void btnRapportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRapportActionPerformed
//        RapportOutput out = new RapportOutput();
//        out.setLam(lam);
//        out.setVisible(true);
    }//GEN-LAST:event_btnRapportActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnChart;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnEdit;
    private javax.swing.JButton btnExport;
    private javax.swing.JButton btnLayUp;
    private javax.swing.JButton btnMore;
    private javax.swing.JButton btnRapport;
    private javax.swing.JComboBox cbChart;
    private javax.swing.JComboBox cbChartType;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JLabel lblE1;
    private javax.swing.JLabel lblE2;
    private javax.swing.JLabel lblERho;
    private javax.swing.JLabel lblG12;
    private javax.swing.JLabel lblH;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblRho;
    private javax.swing.JLabel lblv12;
    // End of variables declaration//GEN-END:variables

public void reCalculate()
    {
        if(lam != null)
        {
            this.setVisible(true);
            lblName.setText(lam.getName());
            if(lam.checkLayersBiggerThanZero())
            {

                lblE1.setText("0 GPa");
                lblE2.setText("0 GPa");
                lblG12.setText("0 GPa");
                lblv12.setText("0");
                lblH.setText("0 mm");
                lblRho.setText("0 Kg/m3");
            }
            else
            {
                Laminaat l = lam;
                double e1 = lam.getE1();
                //double rho = Calc.Rho(l.getLam(), Global.data);
                double rho = lam.getRho();
                double eRho = (e1/rho)/1e6;
                e1=e1/1e9;
                double e2 = lam.getE2();
                //double e3 = Calc.E3(l.getLam(), Global.data)/1e9;
                double e3 = lam.getE3();
                double nu12 = lam.getMu12();
                //double nu23 = Calc.Nu23(l.getLam(), Global.data);
                double nu23 = lam.getMu23();
                //double nu31 = Calc.Nu31(l.getLam(), Global.data);
                double nu31 = lam.getMu31();
                double g12 = lam.getG12();
                //double g23 = Calc.G23(l.getLam(), Global.data)/1e9;
                double g23 = lam.getG23();
                //double g31 = Calc.G31(l.getLam(), Global.data)/1e9;
                double g31 = lam.getG31();
                double dikte = l.calculateTotalHeight();
               
                
                lblERho.setText(String.valueOf(Calc.Round(eRho, 2))+ " MPa/Kg");
                lblE1.setText(String.valueOf(Calc.Round(e1, 2)));
                lblE2.setText(String.valueOf(Calc.Round(e2, 2)));
                lblG12.setText(String.valueOf(Calc.Round(g12, 2)));
                lblv12.setText(String.valueOf(Calc.Round(nu12, 2)));
                lblH.setText(String.valueOf(dikte));
                lblRho.setText(String.valueOf(Calc.Round(rho, 2)));

            }

            if(lam.checkLayersBiggerThanZero())
            {
                btnChart.setEnabled(false);
                btnExport.setEnabled(false);
                btnLayUp.setEnabled(false);
                cbChart.setEnabled(false);
                cbChartType.setEnabled(false);
                btnRapport.setEnabled(false);
            }
            else
            {
                btnChart.setEnabled(true);
                btnExport.setEnabled(true);
                btnLayUp.setEnabled(true);
                cbChart.setEnabled(true);
                cbChartType.setEnabled(true);
                btnRapport.setEnabled(true);
            }
        }
        else
        {
            this.setVisible(false);
        }
    }
}
